1. Introduction
The TreeList package contains a new field type that provides the following functionality:
- The field consists of two columns: A Content Tree on the left and a list of selected Items on the right.
- Any Items may be added to the list regardless of the content tree hierarchy.
Please refer to the Creating a Composite Custom Field article for more information about custom fields.
2. Installation
The TreeList field is distributed as a standard Sitecore package. Thus, to start using it, you must install the package. Please refer to the Installing Modules and Packages article if you are not familiar with the standard Sitecore Packager tool.
After the package installation, you will see the TreeList field in the list of Field types (System/Field types).
You can add this field to a template section and create Items based on this template.
You need to edit the web.config file to make the control work.
-
Add the following line to the <controlSources> section
<source mode="on" namespace="Sitecore.WebControls" assembly="TreeList" prefix="sc4"/>
-
Add the following line (if it is not yet present) to the <ui><using> section:
<using>Sitecore.WebControls</using>
-
Add the following line (if it is not yet present) to the <ui><references> section
<reference>/bin/treelist.dll</reference>
3. User Manual
A User can set the conditions that define which Items may be added to the tree list.
These conditions are set in the Source field of the TreeList field.
Create a new field and select TreeList as a field type.
You can adjust the properties of the field by specifying the Source parameters:
-
DataSource
Parameter type: path
Use this parameter to specify the root Item of the tree; -
AllowMultipleSelection
Parameter type: Boolean (yes/no)
If this parameter is set to yes, a User can add the same Item to the list more than once. By default, a User can only add one instance of an Item to the list; -
ExcludeTemplatesForSelection
Parameter type: List of template names
If you want to forbid selecting Items based on certain templates, you can list these templates here using a comma to separate template names. There must be no spaces between the names and the commas. By default, all templates are allowed.
-
IncludeTemplatesForSelection
Parameter type: List of template names
If you want to allow selecting only Items based on certain templates, you should list these templates in this parameter. There must be no spaces between the names and the commas.
-
ExcludeTemplatesForDisplay
Parameter type: List of template names
If you want to filter out Items based on certain templates from the content tree, you can list these templates here using a comma to separate template names. There must be no spaces between the names and the commas.
-
IncludeTemplatesForDisplay
Parameter type: List of template names
If you want to include only Items based on certain templates in the content tree, you can list these templates here using a comma to separate template names. There must be no spaces between the names and the commas.
If you want to use several parameters, you should use the ampersand (&) sign to separate each parameter. For example, your Source field might look like this:
ControlDataSource=/sitecore/content/home&AllowMultipleSelecton=no&ExcludeTemplates= Document,LinkedDocument
In this case, if you try to add an Item twice, you will get the following message: